#ifndef RTW_HEADER_FOC_Function_h_
#define RTW_HEADER_FOC_Function_h_
#include <string.h>
#ifndef FOC_Function_COMMON_INCLUDES_
#define FOC_Function_COMMON_INCLUDES_
#include "rtwtypes.h"
#endif

#ifndef rtmGetErrorStatus
#define rtmGetErrorStatus(rtm)         ((rtm)->errorStatus)
#endif

#ifndef rtmSetErrorStatus
#define rtmSetErrorStatus(rtm, val)    ((rtm)->errorStatus = (val))
#endif

typedef struct tag_RTM RT_MODEL;
typedef struct {
    uint32_T FOC_ELAPS_T;
    uint32_T FOC_PREV_T;
    uint32_T Speed_loop_PREV_T;
    int16_T Saturation;
    int16_T FOC_Code_C_boundary_DTC5;
    int16_T FOC_Code_C_boundary_DTC2;
    int16_T SignCorrected;
    int16_T Add1;
    int16_T FOC_Code_C_boundary_DTC3;
    int16_T FOC_Code_C_boundary_DTC4;
    int16_T Saturation_e;
    int16_T Add;
    int16_T DiscreteTimeIntegrator_DSTATE;
    int16_T DiscreteTimeIntegrator_DSTATE_d;
    int16_T DiscreteTimeIntegrator_DSTAT_dz;
    int16_T DiscreteTimeIntegrator_PREV_U;
    int16_T DiscreteTimeIntegrator_PREV_U_e;
    int16_T DiscreteTimeIntegrator_PREV_U_h;
    uint16_T FOC_Code_C_boundary_DTC1;
    uint16_T FOC_Code_C_boundary_DTC;
    uint8_T DiscreteTimeIntegrator_SYSTEM_E;
    uint8_T DiscreteTimeIntegrator_SYSTEM_c;
    uint8_T DiscreteTimeIntegrator_SYSTEM_b;
    boolean_T FOC_RESET_ELAPS_T;
    boolean_T Speed_loop_RESET_ELAPS_T;
} DW;

typedef struct {
    int16_T pooled5[257];
} ConstP;

typedef struct {
    real_T Taon_j;
    real_T Tbon_f;
    real_T Tcon_a;
} ExtY;

typedef struct PI_Parameter_tag {
    uint16_T Ki_id;
    uint16_T Ki_iq;
    uint16_T Kp_id;
    uint16_T Kp_iq;
} PI_Parameter_type;

struct tag_RTM {
    const char_T * volatile errorStatus;
    struct {
        uint32_T clockTick0;
        uint32_T clockTick1;
        struct {
            uint8_T TID[2];
        } TaskCounters;
    } Timing;
};

extern DW rtDW;
extern ExtY rtY;
extern const ConstP rtConstP;
extern real32_T Bus_voltage;
extern real32_T Theta_real;
extern real32_T Target_Speed;
extern real32_T Ia;
extern real32_T Speed_RPM;
extern real32_T Ib;
extern real32_T Ic;
extern int16_T Iq_ref;
extern int16_T Id_measured;
extern int16_T Iq_measured;
extern int16_T Tbon;
extern int16_T Taon;
extern int16_T Tcon;
extern void FOC_Function_initialize(void);
extern void FOC_Function_step(void);
extern PI_Parameter_type PI_Parameter;
extern RT_MODEL *const rtM;

#endif

